<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    var arry = [], sum = 0, avg = 0, arry1 = [];
    var flag = false, n = 0, flag1 = false;
    for (var i = 0; i < 10; i++) {
        arry[i] = Math.round(1 + Math.random() * 100);
        sum += arry[i];
        if (arry[i] >= 60) { //一个满足条件也执行
            flag = true;
            n++
            if (n == 10) { //全部都满足条件才执行·另一种方法是只要有一种不满足条件就是false
                flag1 = true;
            }
        }
        if (arry[0] > arry[i]) {
            arry[0] = arry[i];
        }
    }

    avg = sum / arry.length;
    for (i = 0; i < 10; i++) {
        if (arry[i] > avg) {
            arry1[arry1.length] = arry[i];
        }
    }
    console.log(" 原数组：" + arry + "\n", "和：" + sum + "\n", "平均值：" + avg + "\n", "大于平均值的数组：" + arry1);
    console.log(flag, flag1);
    console.log("最小值为：" + arry[0]);

    for (i = 0; i < arry.length - 1; i++) {
        for (var j = 0; j < arry.length - i - 1; j++) {
            if (arry[j] > arry[j + 1]) {
                var x = arry[j];
                arry[j] = arry[j + 1];
                arry[j + 1] = x;
            }
        }
    }
    console.log(arry);


</script>

</html>